<template>
    <view class="body">
		<view class="bodycontent">
		   <view class="mima">
			   <text>输入原密码</text>
			   <input v-model="possword" class="putkuan" password type="text" placeholder="请输入原密码"></input>
		   </view>
		   <view class="mima">
			   <text>输入新密码</text>
			   <input v-model="newpossword1" class="putkuan" password type="text" placeholder="请输入新密码"></input>
		   </view>
		   <view class="mima1">
			   <text>输入新密码</text>
			   <input v-model="newpossword2" class="putkuan" password type="text" placeholder="请再输入新密码"></input>
		   </view>
		</view>
	    <button class="anniu" @click="baocun">保存</button>
	</view>
</template>

<script>

    export default {
        data() {
            return {
				userid:'',
				possword:'',
				newpassword:'',
				newpossword1:'',
				newpossword2:'',
				msg:''
            }
        },
        methods: {
		   baocun () {
			   if (this.newpossword1 == this.newpossword2){
				   console.log('---222');
				   uni.request({
				   	url: 'http://xj.gccrw.cn/api/User/savePassword', 
				   	data: {
				   		uid: this.userid,
				   		password:this.possword,
				   		newpassword:this.newpossword1,
				   		newpassword:this.newpossword2
				   	},
				   	method: "POST",
				   	success: (res) => {
				   		uni.navigateTo({
				   			url:'/pages/login/login',
							success:(res) => {
								uni.showToast({
									title:'修改成功'
								})
							}
				   		})
				   	}
				   })
			   }else {
				   console.log('---333');
				   uni.showToast({
				   	title:'新密码不一致'
				   })
			   }
		   }
        },
		onLoad (e) {
			console.log('----112321---',e.uid);
			this.userid = e.uid
		}
    }
</script>

<style>
.bodycontent {
	width: 94%;
	background-color: #FFFFFF;
	border-radius: 23upx;
	margin: 3%;
	display: flex;
	flex-direction: column;
}
.mima {
	display: flex;
	padding: 28upx;
	border-bottom: 2upx solid #F3F3F3;
}
.mima1 {
	display: flex;
	padding: 28upx;
}
.putkuan {
	margin-left: 20upx;
}
.anniu{
	width: 100%;
	/* background-color: #A7BCE7; */
	background-color: #3C6DD2;
	margin-top: 788upx;
	border-radius: 0%;
	color: #FFFFFF;
}
</style>
